<template>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide swiper-slide1">Slide 1</div>
            <div class="swiper-slide swiper-slide2">Slide 2</div>
            <div class="swiper-slide swiper-slide3">Slide 3</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
        
        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
    </div>
</template>

<script>
import $ from 'jquery';
import Swiper from 'swiper';
import 'swiper/css/swiper.min.css'

$(function() {
    var mySwiper = new Swiper ('.swiper-container', {
        loop: false, // 循环模式选项 当播放到最后一张图片后，点击按钮是否会继续轮播
        
        // 如果需要分页器 即轮播图下面的小圆点
        pagination: {
            el: '.swiper-pagination',
        },
        
        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
        effect: 'fade', // 轮播的图片不是滑动，而是改为淡入淡出效果
        autoplay: {
            delay: 3000, // 自动播放的间隔时间，单位ms，默认3000ms
            disableOnInteraction: false, // 用户操作后是否停止自动播放，默认为true，即停止。改为false，表示不会停止自动播放
        }
    })
})

export default {
    name: 'HelloWorld'
}
</script>

<style scoped>
.swiper-container {
    width: 500px;
    height: 400px;
}
.swiper-slide {
    text-align: center;
    line-height: 400px;
    color: #b0b0b0;
}
.swiper-slide1 {
    background: red;
}

.swiper-slide2 {
    background: blue;
}

.swiper-slide3 {
    background: yellow;
}
</style>